package com.liuwei.msmall.getway.filter;

import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

/**
 * 添加一个过滤器做token校验
 */
public class TokenFilter {


//    @Override
    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {

//        ServerHttpRequest request = exchange.getRequest();
////        InetSocketAddress remoteAddress = request.getRemoteAddress();
////        System.out.println(remoteAddress);
////        System.out.println(remoteAddress.getHostName());
////        ServerHttpResponse response = exchange.getResponse();
//        HttpHeaders headers = request.getHeaders();
//        String token = headers.getFirst("token");
//        if (StringUtils.isBlank(token)){
//
//        }
//        System.out.println("get token : "+token);

        return chain.filter(exchange);
    }


}
